﻿<!--#include file="const.inc"-->
<%
IF Request.QueryString("Action")="login" Then
	call loginn
else
	call index
end if
end Function
Private Function getIP() 
Dim strIPAddr,str 
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then 
strIPAddr = Request.ServerVariables("REMOTE_ADDR") 
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then 
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1) 
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then 
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1) 
Else 
strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
End If 
getIP = Trim(Mid(strIPAddr, 1, 30))
End Function
Function index
dim url
url=Request.QueryString("url")
if url="" then url="index.asp"
select case v
case "0"
we0="<br/>"
%>
<card title="登陆"><p align="left"><%=qingtian.qingsav("45")%>
	欢迎登陆<%=qingtian.mainname%><br/>
	输入用户名/手机号:<br/><input emptyok="true"  name="name" type="text" size="15"/><br/>
	请输入登陆密码:<br/><input emptyok="true"  type="password" name="pass" size="15"/><br/>
        自动登陆:<select title='使用' name='lur' value='0'><option title='使用' value='0'>使用</option><option title='禁用' value='1'>禁用</option></select><br/>
        我的状态:<select title='在线' name='lurr' value='0'><option title='在线' value='0'>在线</option><option title='隐身' value='1'>隐身</option></select><br/>
	<anchor>确认提交登录
    	<go href="login.asp?Action=login&amp;sid=<%=sidd%>&amp;url=<%=url%>" method='post'>
        <postfield name="name" value="$(name)"/>
        <postfield name="pass" value="$(pass)"/>
        <postfield name="lur" value="$(lur)"/>
        <postfield name="lurr" value="$(lurr)"/>
    	</go>
	</anchor><br/>提示:隐身登陆只适合vip会员使用!没账号,那就赶快<a href="reg.asp?sid=<%=sidd%>&amp;url=<%=url%>">免费注册</a>吧!<br/>---------------<br/><%=qingtian.qingsav("46")%>
<a href="<%=qingtian.backurl(url)%>">返回来源页</a><br/>
<%
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>登陆</title>
</head>
<body>
<%=dao%>欢迎登陆<%=qingtian.mainname%><%=we0%><%=qingtian.qingsav("45")%>
	<form action="login.asp?Action=login&amp;sid=<%=sidd%>&amp;url=<%=url%>" method="post"><%=we%>输入用户名/手机号:<%=we0%><input emptyok="true"  name="name" type="text" size="15"/><%=we%>请输入登陆密码:<%=we0%><input emptyok="true"  type="password" name="pass" size="15"/><%=we0%><%=we%>自动登陆:<select title='使用' name='lur' value='0'><option title='使用' value='0'>使用</option><option title='禁用' value='1'>禁用</option></select><%=we0%><%=we%>我的状态:<select title='在线' name='lurr' value='0'><option title='在线' value='0'>在线</option><option title='隐身' value='1'>隐身</option></select><%=we0%><input type="submit" value="确认提交登录" /></form><br/><%=we%>提示:<%=zi%>隐身登陆只适合vip会员使用!<%=zi0%>没账号,那就赶快<a href="reg.asp?sid=<%=sidd%>&amp;url=<%=url%>">免费注册</a>吧!<%=we0%><%=dao%>---------------<%=we0%><%=qingtian.qingsav("46")%>
<%=sou%><a href="<%=qingtian.backurl(url)%>">返回来源页</a><%=we0%>
<%

End Select
%>
	
<%
End Function


Function loginn

dim url,lur,ip,nip
ip=getIP()
url=Request.QueryString("url")
lur=clng(Request.form("lur"))
lurr=clng(Request.form("lurr"))
	IF Request.form("name")<>"" and Request.form("pass")<>"" then
		dim name,pass,rs,sql,i
		name=Replace(Request.form("name"),"'","''")
		pass=md5(Request.form("pass"))

		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select [id],[nologin],[name],[pass],[nl] FROM qingtian_user where [user]='"&name&"' or [mobile]='"&name&"'"
		rs.open sql,conn,1,1
		if rs.eof and rs.bof then

select case v
case "0"
we0="<br/>"
%>
<card id="login" title="登陆出错">
		<p align="left">
		出错了！没有该会员注册信息！请<a href="login.asp?sid=<%=sidd%>&amp;url=<%=url%>">重新登陆</a><br/>
		没账号,那就赶快<a href="reg.asp?sid=<%=sidd%>&amp;url=<%=url%>">免费注册</a>吧!<br/>---------------<br/>
<%
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>登陆出错</title>
</head>
<body>
<%=we%>出错了！没有该会员注册信息！请<a href="login.asp?sid=<%=sidd%>&amp;url=<%=url%>">重新登陆</a><%=we0%>
<%=sou%>没账号,那就赶快<a href="reg.asp?sid=<%=sidd%>&amp;url=<%=url%>">免费注册</a>吧!<br/>---------------<%=we0%>
<%

End Select
%>
		<%elseif rs("pass")=pass  then
                             
			if rs("nologin")<>true then


				sid=qingtian.RunStr
                                nip=rs("nl")
				sid=md5(rs("id")&Request.form("pass")&sid)
				sid=ucase("3gqt"&md5(strReverse(sid)))
                                sidd=sid&"-"&v&"-"&fv&"-"&midqd
                                siddd=sid&"-"&v&"-a-"&midqd
				conn.execute("update [qingtian_user] set [sid]='"&md5(sid) & md5(strReverse(sid))&"',[sidd]='"&siddd&"',[lurr]="&lurr&",[nl]='"&ip&"' where [id]="&rs("id")&"")
qingtian.addong("成功登陆本站")
if lur=1 then
response.cookies("sid")=""
else
response.cookies("sid")=sid
end if			
select case v
case "0"
we0="<br/>"
%>
<card id="login" title="登陆成功"  ontimer="<%=qingtian.backurl(url)%>"><timer value='30'/>
				<p align="left">
				登陆成功！欢迎你继续访问本站，你上次的登录ip是：<%=nip%>，进入<a href='user/index.asp?sid=<%=sidd%>'>我的地盘</a><br/>
				<a href="<%=qingtian.backurl(url)%>">返回来源页</a><br/>
			
<%
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>登陆成功</title>
</head>
<body>
<%=we%>登陆成功！欢迎你继续访问本站，你上次的登录ip是：<%=nip%>，进入<a href='user/index.asp?sid=<%=sidd%>'>我的地盘</a><br/><%=we0%>
<%=sou%><a href="<%=qingtian.backurl(url)%>">返回来源页</a><%=we0%>
<%
End Select
%>
				
			<%else%>
<%

select case v
case "0"
we0="<br/>"
%>
<card id="login" title="登陆出错"  ontimer="<%=qingtian.backurl(url)%>"><timer value='30'/>
				<p align="left">
				出错了！你已被禁止登陆,有任何问题请联系本站管理员。<br/>
				<a href="<%=qingtian.backurl(url)%>">返回来源页</a><br/>
			
<%
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>登陆出错</title>
</head>
<body>
<%=we%>出错了！你已被禁止登陆,有任何问题请联系本站管理员。<%=we0%>
<%=sou%><a href="<%=qingtian.backurl(url)%>">返回来源页</a><%=we0%>
<%
End Select				
                end if
		else

select case v
case "0"
we0="<br/>"
%>
<card id="login" title="登陆出错">
		<p align="left">
		出错了！你输入的密码错误。请<a href="login.asp?sid=<%=sidd%>&amp;url=<%=url%>">重新登陆</a><br/>没账号,那就赶快<a href="reg.asp?sid=<%=sidd%>&amp;url=<%=url%>">免费注册</a>吧!
<%
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>登陆出错</title>
</head>
<body>
<%=we%>出错了！你输入的密码错误。请<a href="login.asp?sid=<%=sidd%>&amp;url=<%=url%>">重新登陆</a><%=we0%>
<%=sou%>没账号,那就赶快<a href="reg.asp?sid=<%=sidd%>&amp;url=<%=url%>">免费注册</a>吧!<%=we0%>
<%
End Select
%>
		<%
		end if
		rs.Close
		Set rs = Nothing


	else%>
<%

select case v
case "0"
we0="<br/>"
%>
<card id="login" title="登陆出错">
		<p align="left">
		<%if Request.form("name")="" then%>
		出错了！输入的用户名不能为空。<br/>
		<%end if%>
		<%if Request.form("pass")="" then%>
		输入的密码不能为空。<br/>
		<%end if%>
		请<a href="login.asp?sid=<%=sidd%>&amp;url=<%=url%>">重新登陆</a><br/>没账号,那就赶快<a href="reg.asp?sid=<%=sidd%>&amp;url=<%=url%>">免费注册</a>吧!
<%
case "1"
hr="<hr>"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>登陆出错</title>
</head>
<body>
<%if Request.form("name")="" then%>
		<%=we%>出错了！输入的用户名不能为空。<%=we0%>
		<%end if%>
		<%if Request.form("pass")="" then%>
		<%=we%>输入的密码不能为空。<%=we0%>
		<%end if%>
		<%=sou%>请<a href="login.asp?sid=<%=sidd%>&amp;url=<%=url%>">重新登陆</a><br/>
没账号,那就赶快<a href="reg.asp?sid=<%=sidd%>&amp;url=<%=url%>">免费注册</a>吧!<%=we0%>
<%
End Select
%>
<%
	end if
%>

<%
end Function 
%>
